/*
 * FNISVGEditor - JavaScript - based editor for SVG graphics 
 * Copyright (C) 2008 - 2009 Antti Leppä / Foyt
 * http://www.foyt.fi
 * 
 * License: 
 * 
 * Licensed under GNU Lesser General Public License Version 2.1 or later (the "LGPL") 
 * http://www.gnu.org/licenses/lgpl.html
 */
FNISVGEditorUndoEventControllerVault = {  
  getControllerFor : function(event) {
    if (event)
      return this.getController(event.getEventType());
    else
      throw new Error("Cannot return controller for null event");
  },
  getController : function(type) {
    var controller = this._getControllerHash().get(type);
    if (!controller) {
      throw new Error("Could not find controller for: " + type);    
    } else
      return controller;
  },
  registerController : function(controller) {    
    this._getControllerHash().set(controller.getEventType(), controller);
  },
  _getControllerHash: function () {
    if (!this._controllers)      
      this._controllers = new Hash();
    return this._controllers;
  }
};

function GetFNISVGEditorUndoEventControllerVault() {
  return FNISVGEditorUndoEventControllerVault;
}